.class public Lcom/waiqin365/h5/ui/WqSingleSelectUI;
.super Lorg/apache/cordova/CordovaPlugin;

# interfaces
.implements Ljava/util/Observer;


# instance fields
.field public final a:Ljava/lang/String;

.field private b:Ljava/util/List;

.field private c:Ljava/util/List;

.field private d:Ljava/util/List;

.field private e:Ljava/lang/String;

.field private f:Ljava/lang/String;

.field private g:Lorg/apache/cordova/WqCordovaActivity;

.field private h:Lorg/apache/cordova/CallbackContext;

.field private i:I


# direct methods
.method public constructor <init>()V
    .locals 1

    invoke-direct {p0}, Lorg/apache/cordova/CordovaPlugin;-><init>()V

    invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->a:Ljava/lang/String;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->b:Ljava/util/List;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->d:Ljava/util/List;

    const-string/jumbo v0, ""

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->e:Ljava/lang/String;

    const-string/jumbo v0, ""

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->f:Ljava/lang/String;

    const/4 v0, 0x0

    iput v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->i:I

    return-void
.end method


# virtual methods
.method public execute(Ljava/lang/String;Lorg/apache/cordova/CordovaArgs;Lorg/apache/cordova/CallbackContext;)Z
    .locals 7

    const/4 v1, 0x1

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->cordova:Lorg/apache/cordova/CordovaInterface;

    invoke-interface {v0}, Lorg/apache/cordova/CordovaInterface;->getActivity()Landroid/app/Activity;

    move-result-object v0

    check-cast v0, Lorg/apache/cordova/WqCordovaActivity;

    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->g:Lorg/apache/cordova/WqCordovaActivity;

    iput-object p3, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->h:Lorg/apache/cordova/CallbackContext;

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->b:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->d:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    if-eqz p2, :cond_7

    invoke-virtual {p2, v2}, Lorg/apache/cordova/CordovaArgs;->isNull(I)Z

    move-result v0

    if-nez v0, :cond_7

    invoke-virtual {p2, v2}, Lorg/apache/cordova/CordovaArgs;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v3

    if-nez v3, :cond_5

    :try_start_0
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string/jumbo v0, "hasSelectItem"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    const-string/jumbo v0, "hasSelectItem"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_0
    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->e:Ljava/lang/String;

    const-string/jumbo v0, "title"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    const-string/jumbo v0, "title"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_1
    iput-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->f:Ljava/lang/String;

    const-string/jumbo v0, "showToLevel"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_2

    const-string/jumbo v0, "showToLevel"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_2
    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->i:I

    const-string/jumbo v0, "items"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_5

    const-string/jumbo v0, "items"

    invoke-virtual {v3, v0}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v0

    if-eqz v0, :cond_5

    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result v3

    if-lez v3, :cond_5

    :goto_3
    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result v3

    if-ge v2, v3, :cond_3

    invoke-virtual {v0, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v3

    new-instance v4, Lcom/waiqin365/h5/ui/b/a;

    invoke-direct {v4}, Lcom/waiqin365/h5/ui/b/a;-><init>()V

    const-string/jumbo v5, "selectItem"

    const-string/jumbo v6, ""

    invoke-virtual {v3, v5, v6}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    iput-object v5, v4, Lcom/waiqin365/h5/ui/b/a;->b:Ljava/lang/String;

    const-string/jumbo v5, "selectId"

    const-string/jumbo v6, ""

    invoke-virtual {v3, v5, v6}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v4, Lcom/waiqin365/h5/ui/b/a;->a:Ljava/lang/String;

    iget-object v3, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->b:Ljava/util/List;

    invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    add-int/lit8 v2, v2, 0x1

    goto :goto_3

    :cond_0
    const-string/jumbo v0, ""

    goto :goto_0

    :cond_1
    const-string/jumbo v0, ""

    goto :goto_1

    :cond_2
    const-string/jumbo v0, "0"

    goto :goto_2

    :cond_3
    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->e:Ljava/lang/String;

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_4

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->e:Ljava/lang/String;

    const-string/jumbo v2, ","

    invoke-virtual {v0, v2}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v0

    iget-object v2, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->d:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->clear()V

    iget-object v2, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->d:Ljava/util/List;

    invoke-static {v0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v2, v0}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    :cond_4
    invoke-static {}, Lcom/waiqin365/lightapp/view/a/b;->a()Ljava/util/Observable;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/util/Observable;->addObserver(Ljava/util/Observer;)V

    new-instance v2, Landroid/content/Intent;

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->g:Lorg/apache/cordova/WqCordovaActivity;

    const-class v3, Lcom/waiqin365/lightapp/dailyreport/SimpleSelectMultActivity;

    invoke-direct {v2, v0, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string/jumbo v3, "list"

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->b:Ljava/util/List;

    check-cast v0, Ljava/io/Serializable;

    invoke-virtual {v2, v3, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    const-string/jumbo v3, "selected"

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->d:Ljava/util/List;

    check-cast v0, Ljava/io/Serializable;

    invoke-virtual {v2, v3, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->f:Ljava/lang/String;

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_6

    const-string/jumbo v0, "title"

    iget-object v3, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->g:Lorg/apache/cordova/WqCordovaActivity;

    const v4, 0x7f080723

    invoke-virtual {v3, v4}, Lorg/apache/cordova/WqCordovaActivity;->getString(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v0, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    :goto_4
    const-string/jumbo v0, "isSingleSelect"

    const/4 v3, 0x1

    invoke-virtual {v2, v0, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    const-string/jumbo v0, "returnTo"

    iget-object v3, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->a:Ljava/lang/String;

    invoke-virtual {v2, v0, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->g:Lorg/apache/cordova/WqCordovaActivity;

    invoke-virtual {v0, v2}, Lorg/apache/cordova/WqCordovaActivity;->startActivity(Landroid/content/Intent;)V

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->g:Lorg/apache/cordova/WqCordovaActivity;

    const v2, 0x7f040022

    const v3, 0x7f040021

    invoke-virtual {v0, v2, v3}, Lorg/apache/cordova/WqCordovaActivity;->overridePendingTransition(II)V

    :cond_5
    :goto_5
    move v0, v1

    :goto_6
    return v0

    :cond_6
    const-string/jumbo v0, "title"

    iget-object v3, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->f:Ljava/lang/String;

    invoke-virtual {v2, v0, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_1

    goto :goto_4

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_5

    :catch_1
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/NumberFormatException;->printStackTrace()V

    goto :goto_5

    :cond_7
    move v0, v2

    goto :goto_6
.end method

.method public update(Ljava/util/Observable;Ljava/lang/Object;)V
    .locals 4

    if-eqz p2, :cond_1

    instance-of v0, p2, Lcom/waiqin365/lightapp/view/a/a;

    if-eqz v0, :cond_1

    iget-object v1, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->a:Ljava/lang/String;

    move-object v0, p2

    check-cast v0, Lcom/waiqin365/lightapp/view/a/a;

    iget-object v0, v0, Lcom/waiqin365/lightapp/view/a/a;->a:Ljava/lang/String;

    invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    check-cast p2, Lcom/waiqin365/lightapp/view/a/a;

    iget-object v0, p2, Lcom/waiqin365/lightapp/view/a/a;->b:Ljava/lang/Object;

    check-cast v0, Ljava/util/List;

    invoke-static {}, Lcom/waiqin365/lightapp/view/a/b;->a()Ljava/util/Observable;

    move-result-object v1

    invoke-virtual {v1, p0}, Ljava/util/Observable;->deleteObserver(Ljava/util/Observer;)V

    iget-object v1, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->clear()V

    if-eqz v0, :cond_0

    iget-object v1, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    :cond_0
    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_1

    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    :try_start_0
    const-string/jumbo v2, "selectId"

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    const/4 v3, 0x0

    invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/waiqin365/lightapp/dailyreport/c/a;

    invoke-interface {v0}, Lcom/waiqin365/lightapp/dailyreport/c/a;->a()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string/jumbo v2, "selectItem"

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->c:Ljava/util/List;

    const/4 v3, 0x0

    invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/waiqin365/lightapp/dailyreport/c/a;

    invoke-interface {v0}, Lcom/waiqin365/lightapp/dailyreport/c/a;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->h:Lorg/apache/cordova/CallbackContext;

    invoke-virtual {v0, v1}, Lorg/apache/cordova/CallbackContext;->success(Lorg/json/JSONObject;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_1
    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    iget-object v0, p0, Lcom/waiqin365/h5/ui/WqSingleSelectUI;->h:Lorg/apache/cordova/CallbackContext;

    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    invoke-virtual {v0, v1}, Lorg/apache/cordova/CallbackContext;->success(Lorg/json/JSONObject;)V

    goto :goto_0
.end method
